
package com.jf.cloud.multishop.controller.admin;

import com.jf.cloud.common.constant.Constant;
import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.multishop.service.CompanyAuditingService;
import com.jf.cloud.multishop.vo.ShopCompanyAuditingVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * @author zz
 * @date 2022/9/13 14:06
 */
@RestController("adminCompanyAuditingController")
@RequestMapping("/mp/shop_company_auditing")
@Tag(name = "admin-工商信息审核情况")
public class CompanyAuditingController {

    @Autowired
    private CompanyAuditingService companyAuditingService;


    @GetMapping("/auditInfo")
    @Operation(summary = "查看申请审核情况" , description = "查看申请审核情况")
    public ServerResponseEntity<ShopCompanyAuditingVO> auditInfo(@ParameterObject @RequestParam(value = "shopId", required = false) Long shopId) {
        Long tenantId = AuthUserContext.get().getTenantId();
        if (!Objects.equals(tenantId, Constant.PLATFORM_SHOP_ID)) {
            shopId = tenantId;
        }
        return ServerResponseEntity.success(companyAuditingService.getAuditInfo(shopId));
    }
}
